//package/index.js
import type { App, Component, DefineComponent } from "vue";
import CommonMenu from "@/package/CommonMenu/index.vue";
import modalComp from "@/package/littleComp/modalComp.vue";
import mainContent from "@/package/littleComp/mainContent.vue";
import tableCrud from "@/package/tableCrud/index.vue";
import searchForm from "@/package/tableCrud/search-form.vue";
import crudForm from "@/package/tableCrud/form.vue";
interface comIns {
  name: string;
  component: Component | DefineComponent;
}

// 批量组件注册
// 将来如果有其它组件,都可以写到这个数组里
const comps: comIns[] = [
  { name: "CommonMenu", component: CommonMenu },
  { name: "modalComp", component: modalComp },
  { name: "mainContent", component: mainContent },
  { name: "tableCrud", component: tableCrud },
  { name: "searchForm", component: searchForm },
  { name: "crudForm", component: crudForm },
];

const install = function (Vue: App) {
  comps.forEach((com: comIns) => {
    Vue.component(com.name, com);
  });
};

export {
  CommonMenu,
  modalComp,
  mainContent,
  tableCrud,
  searchForm,
  crudForm,
};
export default install; // 这个方法以后再使用的时候可以被use调用
